# -*- coding: UTF-8 -*-
#删除静音帧

import pandas as pd

#静音帧数组，由于静音帧一般需要通过数据观察，推断出大致可能存在静音片段的数据帧，判断和标记通常都是需要耗费大量时间的手动过程。
#也可以考虑用某种方法对信号幅值波动较小的信号段进行判断，尽可能将其自动化，这里还是采取一种通过观察手动对三把刀具静音帧进行标记的方法。

delete_01 = ['1_1','1_2','1_3','1_4','1_5','1_6','1_7','1_8','1_9','1_10','1_11','1_12','1_13','1_14','1_15','1_16','1_17',
             '1_18','1_19','1_20','1_21','1_22','1_23','1_24','1_25','1_26','1_27','1_28','1_29','1_30','1_31','1_32','1_33','1_34',
             '1_35','1_36','1_37','1_38','1_39','1_40','1_41','2_78','40_83','48_1','48_2','48_3','48_4','48_5','48_6','48_7','48_8',
             '48_9','48_10','48_11','48_12','48_13','48_14','48_15','48_16','48_17','48_18','48_19','48_20','48_21','48_22','48_23',
             '48_24','48_25','48_26','48_27','48_28','48_29','48_30','48_31','48_32','48_33','48_34','48_35','48_36','48_37','48_38',
             '48_39','48_40','48_41','48_42','48_43','48_44','48_45','48_46','48_47','48_48','48_49','48_50','48_51','48_52','48_53',
             '48_54','48_55','48_56','48_57','48_58','48_59','48_60','48_61','48_62','48_63','48_64','48_65','48_66','48_67','48_68',
             '48_69','48_70','48_71','48_72','48_73','48_74','48_75','48_76','48_77','48_78','48_79','48_80','48_81','48_82','48_83',
             '48_84','48_85','48_86','48_87','48_88','48_89','48_90','48_91','48_92','48_93','48_94','48_95','48_96','48_97','48_98',
             '48_99','48_100','48_101','48_102','48_103','48_104','48_105','48_106','48_107','48_108','48_109','48_110','48_111',
             '48_112','48_113','48_114','48_115','48_116','48_117','48_118','48_119','48_120','48_121']

delete_02 = ['14_1','14_2','14_3','14_4','14_5','14_6','14_7','21_67','21_68','21_69','21_70','21_71','21_72','21_73','21_74','21_75',
             '21_76','21_77','21_78','21_79','21_80','21_81','21_82','21_83','35_50','35_51','35_52','35_53','35_54','35_55','35_56',
             '35_57','35_58','35_59','35_60','35_61','35_62','35_63','35_64','35_65','35_66','35_67','35_68','35_69','35_70','35_71',
             '35_72','35_73','35_74','35_75','35_76','35_77','35_78','35_79','35_80','35_81','35_82','35_83','35_84','35_85','35_86',
             '35_87','35_88','35_89','35_90','35_91','35_92','35_93','35_94','35_95','35_96','35_97','35_98','35_99','35_100','42_1',
             '42_2','42_3','42_4','42_5','42_6','42_7','42_8','42_9','42_10','42_11','42_12','42_13','42_14','42_15','42_16','42_17',
             '42_18','42_19','42_20','42_21','42_22','42_23','42_24','42_25','42_26','42_27','42_28','42_29','42_30','42_31','42_32']

delete_03 = ['1_1','1_2','1_3','1_4','1_5','1_6','1_7','1_8','1_9','1_10','1_11','1_12','1_13','1_14','1_15','1_16','1_17','1_18','1_19',
             '1_20','1_21','1_22','1_23','1_24','1_25','1_26','1_27','1_28','1_29','1_30','1_31','1_32','1_33','1_34','1_35','1_36',
             '1_37','1_38','1_39','8_1','8_2','8_3','8_4','8_5','8_6','8_7','8_8','8_9','8_10','8_11','8_12','8_13','20_111','20_112',
             '20_113','20_114','20_115','20_116','20_117','20_118','20_119','20_120','20_121','30_6','30_7','30_8','30_9','30_10','30_11',
             '30_12','30_13','30_14','30_15','30_16','30_17','30_18','30_19','30_20','30_21','30_22','30_23','30_24','30_25','30_26','30_27',
             '30_28','30_29','30_30','30_31','30_32','30_33','30_34','30_35','30_36','30_37','30_38','30_39','30_40','30_41','30_42','30_43',
             '30_44','30_45','30_46','30_47','30_48','30_49','30_50','30_51','30_52','30_53','30_54','30_55','30_56','30_57','30_58','30_59',
             '30_60','30_61','30_62','30_63','30_64','30_65','30_66','30_67','30_68','30_69','30_70','30_71','30_72','30_73','30_74','30_75',
             '30_76','30_77','30_78','30_79','30_80','30_81','30_82','30_83','30_84','30_85','30_86','30_87','30_88','30_89','30_90','30_91',
             '30_92','30_93','30_94','30_95','30_96','30_97','30_98','30_99','30_100','30_101','30_102','30_103','30_104','30_105','30_106',
             '30_107','30_108','30_109','30_110','30_111','30_112','30_113','30_114','30_115','30_116','30_117','30_118','30_119','30_120',
             '30_121','37_13','37_14','37_15','37_16','37_17','37_18','37_19','37_20','37_21','37_22','37_23','37_24','37_25','37_26',
             '37_27','37_28','37_29','37_30','37_31','37_32','37_33','37_34','37_35','37_36','37_37','37_38','37_39','37_40','37_41',
             '37_42','37_43','37_44','37_45','37_46','37_47','37_48','37_49','37_50','37_51','37_52','37_53','37_54','37_55','37_56',
             '37_57','37_58','37_59','37_60','37_61','37_62','37_63','37_64','37_65','37_66','37_67','37_68','37_69','37_70','37_71',
             '37_72','37_73','37_74','37_75']

#读入已经加好label的文件，即label_gena的输出文件
df_1 = pd.read_csv('/feature/methodfea_train01_label.csv')
df_2 = pd.read_csv('/feature/methodfea_train02_label.csv')
df_3 = pd.read_csv('/feature/methodfea_train03_label.csv')

#将从上述文件中提取的特征行数排除
df_1=df_1[~df_1['file_source'].isin(delete_01)]
df_2=df_2[~df_2['file_source'].isin(delete_02)]
df_3=df_3[~df_3['file_source'].isin(delete_03)]

#删除显示文件名的一列，因为模型训练并不需要
del df_1['file_source']
del df_2['file_source']
del df_3['file_source']

#写入新文件
df_1.to_csv('/feature/methodfea_train01new.csv',index=False)
df_2.to_csv('/feature/methodfea_train02new.csv',index=False)
df_3.to_csv('/feature/methodfea_train03new.csv',index=False)
